#pragma once


#include "OAL/al.h"
#include "IResourceObject.h"
#include "SoundHelpers.h"


class CResourceSoundSource : public IResourceObject
{
	protected:
		const char*		m_file;
		SND_FILETYPE	m_fileType;
		ALuint			m_sourceID;
		ALuint			m_bufferID;

	public:
		CResourceSoundSource();
		~CResourceSoundSource();

		bool CreateSoundSource(const char *_file, SND_FILETYPE _fileType);

		bool OnInitResource(ICompHandler *_handler);
		bool OnFreeResource(ICompHandler *_handler);

		bool BufferData(ALuint _bufferID);
		bool Play();
		bool Pause();
		bool Stop();

		bool IsPlaying();

		inline operator ALuint () const		{ return this->m_sourceID; }
		inline ALuint GetBufferID() const	{ return this->m_bufferID; }
};